Skip to content

feat: add the Bitbucket Cloud merge check app - #1

Merged
shenxianpeng merged 1 commit into
mainfrom
feat/initial-app
Nov 25, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
feat/initial-app

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Commit Check on Bitbucket Cloud pull requests, as two custom merge checks from a Forge app that runs entirely on Atlassian. No server of ours, nothing called outside Atlassian.

What a Bitbucket user gets

Check Runs Checks
Commit Check every push to the pull request every commit's message and author, the branch name on the head, the description's AI rules when body_ai_attribution = true
Commit Check merge message when someone presses Merge the message a squash merge is about to land
  • Rules come from cchk.toml on the destination branch, so a pull request cannot loosen its own rules.
  • [jira] and require_rebase_target work as on GitHub. require_verified shows as skipped, because Bitbucket gives apps no verdict. Squash mode checks at merge.
  • With no config file the defaults apply: reported, never blocking.
  • Blocking a merge needs Bitbucket Premium (Atlassian's rule for every custom merge check).

How

Bitbucket ──event──▶ Forge function (src/index.js)
                       │ read the PR, its commits and the config (requestBitbucket, as the app)
                       │ run commit-check in Pyodide for each commit (src/cli.js)
                       │   git questions answered from those commits (python/commit_check_forge.py)
                       │ add Jira and the rebase target, write the verdict (src/report.js)
          ◀──────────── { success, message }

The unchanged commit-check CLI wheel (2.24.0, pinned by sha256 in package.json) runs in Pyodide. A small shim answers the CLI's git questions from the commits Bitbucket's API returned. Parity tests build a real git repository and compare the real CLI's JSON with the Pyodide run case by case, so a CLI release that asks git something new fails here first.

Measured on the built package: about 2 s on a cold start, a few ms per commit after that. The check answers within 20 s of Forge's 25 s; a check that cannot finish or cannot run fails and says to re-run it.

The report wording (src/report.js) and the Jira check (src/jira.js) are copied from the GitHub App, so both say the same thing.

Names to confirm before the first deploy

These are public, and a renamed module key drops the check from every repository's settings:

  • Check names shown in Bitbucket: Commit Check, Commit Check merge message
  • Module keys: commit-check, commit-check-merge-message
  • App name at forge register: Commit Check
  • README tagline: "Commit policy as code on Bitbucket Cloud pull requests, run entirely on Atlassian."

Not tried yet

The Forge runtime itself, which needs your Atlassian login. The package uses Forge's manual packaging (bundler: manual@2026, a preview feature) so Pyodide's WebAssembly ships as files; manifest.yml passes @forge/manifest validation.

Your steps after merge

From the README: forge login, forge register "Commit Check" (commit the app id it writes), npm run build, forge deploy, forge install in a test workspace, turn on the checks in Bitbucket, open a pull request.

Tests

162 tests pass (including the parity tests against the real CLI 2.24.0), coverage 100%, lint clean, npm run build succeeds.

A Forge app with two custom merge checks: Commit Check runs on every push
to a pull request, Commit Check merge message runs on merge and checks
the squash message. The commit-check CLI runs inside the Forge function
in Pyodide, so the app calls nothing outside Atlassian.
@shenxianpeng
shenxianpeng merged commit 3428cd5 into main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant